
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using ZuDoKu.Utilities;

namespace ZuDoKu
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public abstract class Screen : Control
    {
        #region Member fields and properties

        private Dictionary<string, Texture> _textures;
        public Dictionary<string, Texture> Textures
        {
            get { return _textures; }
        }

        #endregion

        #region Constructors

        public Screen()
        {
            IGraphicsDeviceService graphicsService = (IGraphicsDeviceService)Game.Services.GetService(typeof(IGraphicsDeviceService));
            GraphicsDevice device = graphicsService.GraphicsDevice;

            // Screen background covers entire surface.
            X = 0;
            Y = 0;
            Width = device.PresentationParameters.BackBufferWidth;
            Height = device.PresentationParameters.BackBufferHeight;

            base.Screen = this;
        }

        #endregion

        #region Change
        
        public event EventHandler<ScreenChangeEventArgs> Change;
        protected void OnChange(Screen screen)
        {
            if (Change != null) Change(this, new ScreenChangeEventArgs(screen));
        } 

        #endregion

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            GamePadState state = GamePad.GetState(PlayerIndex.One);
            ProcessInput(state);
        }
    }
}


